﻿using Moria.Common.Enum;
using Redbrick.Silverlight.Common;
using System.Collections.ObjectModel;

namespace Moria
{
	 public class Class
	 {
		  #region Constructors
	  
		  private Class(string title, int adj_hd, int mdis, int msrh, int mstl, int mfos, int mbth, int mbthb, int msav, 
							 int madj_str, int madj_int, int madj_wis, int madj_dex, int madj_con, int madj_chr, MajikType spell, 
							 int m_exp, int first_spell_lev,int[]level_adj)
		  {
				this.adj = new int[] { 0, 0, 0, 0, 0, 0 };
				this.title = title;
				this.adj_hd = adj_hd;
				this.mdis = mdis;
				this.msrh = msrh;
				this.mstl = mstl;
				this.mfos = mfos;
				this.mbth = mbth;
				this.mbthb = mbthb;
				this.msav = msav;
				this.madj_str = madj_str;
				this.madj_int = madj_int;
				this.madj_wis = madj_wis;
				this.madj_dex = madj_dex;
				this.madj_con = madj_con;
				this.madj_chr = madj_chr;
				this.spell = spell;
				this.m_exp = m_exp;
				this.first_spell_lev = first_spell_lev;
                this.levelAdj = new int[ level_adj.Length ];
				level_adj.CopyTo(this.levelAdj, 0);
		  }
		  
		  #endregion
		  #region Properties

		  ///<summary>
		  /// type of class		
		  ///</summary>
		  public string title { get; private set; }
		  ///<summary>
		  /// Adjust hit points		
		  ///</summary>
		  public int adj_hd { get; private set; }
		  ///<summary>
		  /// mod disarming traps		
		  ///</summary>
		  public int mdis { get; private set; }
		  ///<summary>
		  /// modifier to searching	
		  ///</summary>
		  public int msrh { get; private set; }
		  ///<summary>
		  /// modifier to stealth		
		  ///</summary>
		  public int mstl { get; private set; }
		  ///<summary>
		  /// modifier to freq-of-search	
		  ///</summary>
		  public int mfos { get; private set; }
		  ///<summary>
		  /// modifier to base to hit	
		  ///</summary>
		  public int mbth { get; private set; }
		  ///<summary>
		  /// modifier to base to hit - bows
		  ///</summary>
		  public int mbthb { get; private set; }
		  ///<summary>
		  /// Class modifier to save	
		  ///</summary>
		  public int msav { get; private set; }
		  ///<summary>
		  /// adjustments			
		  ///</summary>
		  public int madj_str { get { return this.adj[Stat.A_STR.Int()]; } private set { this.adj[Stat.A_STR.Int()] = value; } }
		  public int madj_int { get { return this.adj[Stat.A_INT.Int()]; } private set { this.adj[Stat.A_INT.Int()] = value; } }
		  public int madj_wis { get { return this.adj[Stat.A_WIS.Int()]; } private set { this.adj[Stat.A_WIS.Int()] = value; } }
		  public int madj_dex { get { return this.adj[Stat.A_DEX.Int()]; } private set { this.adj[Stat.A_DEX.Int()] = value; } }
		  public int madj_con { get { return this.adj[Stat.A_CON.Int()]; } private set { this.adj[Stat.A_CON.Int()] = value; } }
		  public int madj_chr { get { return this.adj[Stat.A_CHR.Int()]; } private set { this.adj[Stat.A_CHR.Int()] = value; } }
		  public int[] adj { get; private set; }
		  public int[] levelAdj { get; private set; }

		  ///<summary>
		  /// class use mage spells	
		  ///</summary>
		  public MajikType spell { get; private set; }
		  ///<summary>
		  /// Class experience factor	
		  ///</summary>
		  public int m_exp { get; private set; }
		  ///<summary>
		  /// First level where class can use spells. 
		  ///</summary>
		  public int first_spell_lev { get; private set; }

		  #endregion Properties
		  #region Class Table
		  public static readonly Class[] Table =
		  {
				/*                  HP Dis Src Stl Fos bth btb sve S  I  W  D Co Ch  Spell Exp  spl */
				new Class("Warrior",9, 25, 14, 1, 38, 70, 55, 18, 5,-2,-2, 2, 2,-1, MajikType.None,    0, 0, new int[]{ 4, 4, 2, 2, 3 }),
				new Class("Mage",   0, 30, 16, 2, 20, 34, 20, 36,-5, 3, 0, 1,-2, 1, MajikType.Mage,   30, 1, new int[]{ 2, 2, 4, 3, 3 }),
				new Class("Priest", 2, 25, 16, 2, 32, 48, 35, 30,-3,-3, 3,-1, 0, 2, MajikType.Priest, 20, 1, new int[]{ 2, 2, 4, 3, 3 }),
				new Class("Rogue",  6, 45, 32, 5, 16, 60, 66, 30, 2, 1,-2, 3, 1,-1, MajikType.Mage,    0, 5, new int[]{ 3, 4, 3, 4, 3 }),
				new Class("Ranger", 4, 30, 24, 3, 24, 56, 72, 30, 2, 2, 0, 1, 1, 1, MajikType.Mage,   40, 3, new int[]{ 3, 4, 3, 3, 3 }),
				new Class("Paladin",6, 20, 12, 1, 38, 68, 40, 24, 3,-3, 1, 0, 2, 2, MajikType.Priest, 35, 1, new int[]{ 3, 3, 3, 2, 3 })
		  };
		  
		  #endregion
	 }
}
